home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 62 / Mac Magazin and MacEasy Magazine CD - Issue 62.iso / Updates / SoundJam MP WhiteCap / whitecap.sea / WhiteCap 3.1.2 / WhiteCap Source.sit / WhiteCap Source / Headers / WhiteCap.h < prev    next >
C/C++ Source or Header  |  1999-09-14  |  4KB  |  118 lines

  1. #pragma once
  2.  
  3.  
  4. #include "WhiteCapWorld.h"
  5. #include "PixPort.h"
  6. #include "FileSpecList.h"
  7. #include "Prefs.h"
  8. #include "XLongList.h"
  9.  
  10. #if EG_MAC
  11. #include <Files.h>
  12. #endif
  13.  
  14. #define cWhiteCapID        'WCap'
  15. #define cPluginAuthor    'Av55'
  16.  
  17. class WhiteCap {
  18.  
  19.     public:    
  20.         
  21.         // Once you make a new WhiteCap, don't do anything else until you call SetPort() or SetWinRect()
  22.                                 WhiteCap( CEgFileSpec& inPluginsFolder, void* inRefCon = NULL );
  23.                                 ~WhiteCap();
  24.  
  25.         // Calling this assumes that the GrafPort WhiteCap has is a window.  This call simply is a 
  26.         // MacOS/Win32 util to get a rect for the OS window size
  27.         void                    GetWinRect( Rect& outRect );
  28.         
  29.         // Tell's WhiteCap, "work inside this grafPort and keep your slimy butt inside inRect"
  30.         // inAtFullsceen is needed because WC responds to input differently if it's fullscreen mode vs. no.
  31.         void                    SetPort( GrafPtr inPort, const Rect& inRect, bool inAtFullsceen );
  32.         
  33.         // Use this call (instead of SetPort()) when WhiteCap's
  34.         // is in control of its own window (ie, in MacAMP and Winamp)--this call will make a call to
  35.         // SetPort().  In other words, this call is like SetPort() but it also
  36.         // correctly positions WhiteCap's window for you, changing inRect from global cords to local cords
  37.         // If inRect is invalid or NULL, the prefs are used 
  38.         void                    SetWinPort( GrafPtr inPort, const Rect* inRect = NULL );
  39.         
  40.  
  41.         // Tells whitecap: "here's a sound sample and the time is X"
  42.         void                    RecordSample( long inTime, float inSpectrum[] );
  43.  
  44.         // Draws the plugin to the screen, at the time index used in RecordSample().  The part of the
  45.         // screen refreshed is the union of the changed rect since the last call to Draw() and
  46.         // any rects passed to RefreshRect() since the last call to Draw().
  47.         void                    Draw();
  48.     
  49.         void                    SetFullScreen( bool inFullScreen );
  50.         inline bool                IsFullScreen()        { return mAtFullScreen;    }
  51.         
  52.         void                    RefreshRect( const Rect& inUpdate );
  53.  
  54.         void                    SelectConfig();
  55.  
  56.         void                    ToggleFrameCounter()                    { mFrameCount = (mFrameCount >= 0) ? -1 : 0;    }
  57.  
  58.  
  59.         bool                    PtInTitle( Point inPt );
  60.         
  61.         
  62.  
  63.     protected:
  64.     
  65.  
  66.     
  67.         long                    mLastRecordTime;    // Holds the 'current' time
  68.         
  69.         bool                    mDoingSetPortWin;    // true when a thread is currently inside SetPortWin()
  70.         Rect                    mWinRectHolder;        // Win rect holder while we're n FS mode
  71.         Rect                    mDispRect;            // Local cords rect within mOSPort we can draw in
  72.         bool                    mMouseWillAwaken;    // true if moving the mouse will exit fullscreen mode
  73.         GrafPtr                    mOSPort;
  74.         FileSpecList            mConfigs;
  75.         int                        mCurConfigNum;
  76.         XLongList                mConfigPlayList;
  77.         PixPort                    mPort;
  78.         long                     mNextShapeChange;
  79.         bool                    mInSlideShowMode;
  80.         Prefs                    mPrefs;
  81.     
  82.         
  83.         // Plugin prefs
  84.         long                    mSlideShowInterval;
  85.         long                    mScrnSaverDelay;
  86.         long                    mTransitionLo;
  87.         long                    mTransitionHi;
  88.         float                    mMagScale;
  89.         bool                    mShowTitles;
  90.  
  91.         
  92.         // For dumping raw spectrum data
  93.         UtilStr                    mDumpData;
  94.                 
  95.         #define MAX_WORLDS        10
  96.         long                    mNumWorlds;    
  97.         WhiteCapWorld*            mWorld[ MAX_WORLDS ];
  98.  
  99.         // Stuff dealing with full screen mode
  100.         bool                    mAtFullScreen;
  101.         Point                    mLastMousePt;
  102.         long                    mLastActiveTime;
  103.         long                    mFullscreenStartTime;
  104.         
  105.         // Frame rate/calc members.  mFrameCount >= 0 if frame counting/displaying is on
  106.         UtilStr                    mFrameRate;
  107.         long                    mFramesPer10Secs;
  108.         long                    mFrameCountStart;
  109.         long                    mFrameCount;
  110.         
  111.         void                    BuildConfigList( CEgFileSpec& inPluginsFolder );
  112.         void                    LoadConfig( int inConfigNum );
  113.         
  114.         //  Chops up mDispRect into smaller rects, making a rect for each config to be shown.
  115.         void                    ResizeWorlds();
  116.  
  117.         void *                    mRefCon;
  118. };